package _026_Remove_Duplicates_from_Sorted_Array;

public class Solution {
	public static void main(String[] args) {
		int[] nums = {0, 0, 1, 1, 2, 3, 3 ,4, 5, 6};
		System.out.println(new Solution().removeDuplicates(nums));
	}
	
	public int removeDuplicates(int nums[]) {
		
		if(nums.length == 0)	return 0;
		
		int i = 0;
		for(int j = 1; j < nums.length; j++) {
			if(nums[j] != nums[i]) {
				i++;
				nums[i] = nums[j];
			}
		}
		
		return i+1;
	}
}
